package cn.edu.scau.cmi.yangjiamin.client;

import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.stage.Stage;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.scene.control.Label;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;

public class AllClient extends Application{
	@Override
	public void start(Stage primaryStage) throws Exception{
		BorderPane pane = new BorderPane();
		
		
		VBox vboxLeft = new VBox(15);
	    vboxLeft.setPadding(new Insets(5,5,5,5));
		ImageView imageView = new ImageView(new Image("image/photo.jpg"));
		String s = "学号：201616030128  姓名：杨嘉敏";
		Text textPerson = new Text(100, 100, s);
		vboxLeft.getChildren().addAll(imageView,textPerson);
		
		VBox vboxRight = new VBox(15);
	    vboxRight.setPadding(new Insets(5,5,5,5));
	    
	    Button btIPC = new Button("实验一接口编程");//InterProgrammingClient
	    Button btSOMC = new Button("实验二单例模式和多例模式");
	    Button btSFG= new Button("实验三简单工厂模式");
	    Button btFG = new Button("实验三工厂模式");
	    Button btAFG = new Button("实验三抽象工厂模式");
	    Button btAG = new Button("实验四适配器模式");
	    Button btSCG = new Button("实验五安全组合模式");
	    Button btCCG = new Button("实验五一致性组合模式");
	    Button btHC = new Button("实验七Hibernate模式");
	    Button btSC = new Button("实验八Spring模式");
	    Button btCJC = new Button("实验九Spring集成Hibernate");
	    
	    vboxRight.getChildren().addAll(btIPC, btSOMC, btSFG, btFG,btAFG, btAG, btSCG, btCCG, btHC, btSC, btCJC);
	    
		pane.setLeft(vboxLeft);
		pane.setRight(vboxRight);
		
		btIPC.setOnAction(e->{
			new InterProgrammingClient().start(new Stage());
		});
		
		btSOMC.setOnAction(e->{
			try {
			new SingleOrMultiClient().start(new Stage());
			}catch(Exception ex) {
				ex.printStackTrace();
			}
		});
		
		btSFG.setOnAction(e->{
			try {
			new SimpleFactoryGUI().start(new Stage());
			}catch(Exception ex) {
				ex.printStackTrace();
			}
		});
		
		btFG.setOnAction(e->{
			try {
			new FactoryGUI().start(new Stage());
			}catch(Exception ex) {
				ex.printStackTrace();
			}
		});
		
		btAFG.setOnAction(e->{
			try {
			new AbstractFactoryGUI().start(new Stage());
			}catch(Exception ex) {
				ex.printStackTrace();
			}
		});
		
		btAG.setOnAction(e->{
			try {
			new AdapterGUI().start(new Stage());
			}catch(Exception ex) {
				ex.printStackTrace();
			}
		});
		
		btSCG.setOnAction(e->{
			try {
			new SafeCompositeGUI().start(new Stage());
			}catch(Exception ex) {
				ex.printStackTrace();
			}
		});
		
		btCCG.setOnAction(e->{
			try {
			new ConsistentCompositeGUI().start(new Stage());
			}catch(Exception ex) {
				ex.printStackTrace();
			}
		});
		
		btHC.setOnAction(e->{
			try {
			new HibernateClient().start(new Stage());
			}catch(Exception ex) {
				ex.printStackTrace();
			}
		});
		
		btSC.setOnAction(e->{
			try {
			new SpringClient().start(new Stage());
			}catch(Exception ex) {
				ex.printStackTrace();
			}
		});
		
		btCJC.setOnAction(e->{
			try {
			new ComprehensionJavaFXClient().start(new Stage());
			}catch(Exception ex) {
				ex.printStackTrace();
			}
		});
		
		
		
		Scene scene = new Scene(pane, 600, 500);
		primaryStage.setTitle("AllClient");
		primaryStage.setScene(scene);
		primaryStage.show();
		
	}

}
